//
//  LunboViewController.m
//  AILove
//
//  Created by 甘世清 on 2023/12/15.
//

#import "LunboViewController.h"
#import "LoginViewController.h"
#import <YYText.h>
@interface LunboViewController ()

@end

@implementation LunboViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

-(void)SQ_UIViewForSelfView{
   UIImageView * image =  [[UIImageView alloc]init];
    image.image = SQGetImage(@"lunbo背景");
    image.contentMode = UIViewContentModeScaleAspectFill;
    [self.view addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    UILabel * topLabel = [[UILabel alloc]init];
    topLabel.text = SQNSLocalString(@"梦幻虛擬·幻想社交\n大胆做梦·恣意翱翔");
    topLabel.font = FONT_BOLD(26);
    topLabel.numberOfLines = 0;
    topLabel.textColor = UIColor.whiteColor;
    [self.view addSubview:topLabel];
    [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.equalTo(self.view).offset(230);
        make.height.mas_equalTo(80);
    }];
    UILabel * bootomLabel = [[UILabel alloc]init];
    bootomLabel.text = SQNSLocalString(@"各种幻想人物和奇趣故事7*24小时陪伴");
    bootomLabel.font = FONT_MEDIUM(14);
    bootomLabel.textColor = UIColor.whiteColor;
    bootomLabel.numberOfLines = 0;
    bootomLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:bootomLabel];
    [bootomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.equalTo(topLabel.mas_bottom).offset(8);
        make.width.mas_equalTo(SCREEN_WIDETH-60);
    }];
    HeaderView * btn = [[HeaderView alloc]init];
    btn.font = FONT_BOLD(16);
    btn.text = SQNSLocalString(@"开始");
    btn.layer.cornerRadius = 25;
    btn.headerImage.image = SQGetImage(@"按钮背景");
    [btn.btn addTarget:self action:@selector(SQ_buttonClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bootomLabel.mas_bottom).offset(100);
        make.height.mas_equalTo(50);
        make.width.mas_equalTo(SCREEN_WIDETH-60);
        make.centerX.equalTo(self.view);
    }];

   
    YYLabel * label3 = [[YYLabel alloc]initWithFrame:CGRectMake(SCREEN_WIDETH/2.f-65, SCREEN_HEIGHT- FootHeight-60, 130, 40)];
    label3.textVerticalAlignment = YYTextVerticalAlignmentCenter;
    label3.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:label3];
    WS(weakSelf);
    NSDictionary *attributes = @{NSFontAttributeName:FONT_MEDIUM(14) , NSForegroundColorAttributeName: SQColor(@"#D9D9DA")};
    NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString: [ NSString stringWithFormat:@"%@    %@",SQNSLocalString(@"用户协议"),SQNSLocalString(@"隐私条款")] attributes:attributes];
    //设置高亮色和点击事件
    [text yy_setTextHighlightRange:[[text string] rangeOfString:SQNSLocalString(@"用户协议")] color:SQColor(@"#D9D9DA") backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
        CommonWebVcView *vc= [[CommonWebVcView alloc]init];
        vc.urlStr =  YHXY;
        [weakSelf.navigationController pushViewController:vc animated:YES];
    }];
    NSRange range1=[[text string]rangeOfString:SQNSLocalString(@"用户协议")];
    YYTextDecoration* deco=[YYTextDecoration decorationWithStyle:(YYTextLineStyleSingle) width:[NSNumber numberWithInt:1] color:SQColor(@"D9D9DA")];
    [text yy_setTextUnderline:deco range:range1];
    
    //设置高亮色和点击事件
    [text yy_setTextHighlightRange:[[text string] rangeOfString:SQNSLocalString(@"隐私条款")] color:SQColor(@"#D9D9DA") backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
        CommonWebVcView *vc= [[CommonWebVcView alloc]init];
        vc.urlStr =  YSTK;
        [weakSelf.navigationController pushViewController:vc animated:YES];
    }];
    NSRange range2=[[text string]rangeOfString:SQNSLocalString(@"隐私条款") ];
    YYTextDecoration* deco2=[YYTextDecoration decorationWithStyle:(YYTextLineStyleSingle) width:[NSNumber numberWithInt:1] color:SQColor(@"D9D9DA")];
    [text yy_setTextUnderline:deco2 range:range2];
    label3.attributedText = text;
}

-(void)SQ_buttonClick
{
    LoginViewController * vc = [[LoginViewController alloc]init];
       [self SQ_pushViewControllerFull:vc];
       [Manager SQ_SetObject:@"1" FormKey:@"lunbo"];
}
//- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
//
//}

@end
